var color = ["#00CCD2", "#FABF32",  "#FABF32","#B3C9D5", "#1AAFDE", "#07B345", "#FF8300"];
export function barHengChartFun(data) {
	let seriesData = (data.yData || []).map((item, index) => {
		return {
			name: item.name || '',
			type: 'bar',
			barWidth:'7px',
			zlevel: 2,
			itemStyle: {
				color: item.color || color[index],
				barBorderRadius: 30,
			},
			showBackground: true,
			backgroundStyle: {
			    color: 'rgba(216, 216, 216, 0.2)',
			    borderRadius: 30
			},
			data: item.value || [],
		}
	});
	let lineAreaChartsOption = {
		tooltip: {
			trigger: "axis",
		},
		grid: {
			left: '3.5%',
			right: '3.5%',
			bottom: '3.5%',
			top: '18%',
			containLabel: true,
		},
		//图例
		legend: {
			show: data.legendShow === false ? data.legendShow : true,
			// left: data.legendLeft ? data.legendLeft : '10%',
			left: 'center',
			top: '4%',
			textStyle: {
				fontSize: 11,
				color: "#C9DFFF",
			},
			itemWidth: 8,
			itemHeight: 8,
			itemGap: 16,
			icon: 'circle',
		},
		 xAxis: {
			 show: true,
			 type: 'value',
			 axisLine: {
				show: false,
			 },
			 axisLabel: {
				 textStyle: {
					 color: '#F9F9F9',
				 },
			 },
			 axisTick: {
				 show: false,
			 },
			 splitLine: {
				 show: false,
			 },
		 },

		yAxis: {
			data:data.xData,
			axisLine: {
			    show: false,
			},
			axisLabel: {
			    textStyle: {
			        color: 'rgba(255, 255, 255, 0.79)',
			    },
			},
			axisTick: {
			    show: false,
			},
			splitLine: {
			    show: false,
			},
		},
		// dataZoom: [
		//   {
		// 	type: 'slider',
		// 	show: true,
		// 	yAxisIndex: [0], // 控制 Y 轴
		// 	width: 8, // 滚动条宽度
		// 	right: 10, // 距离右侧的距离
		// 	startValue: 0,
		// 	endValue: data.endValue ? data.endValue : 8
		//   },
		//   {
		// 	type: 'inside',
		// 	yAxisIndex: [0],
		// 	moveOnMouseWheel: true // 鼠标滚轮触发平移
		//   }
		// ],
		series: seriesData,
	};
	
	return lineAreaChartsOption
}